import navis
from PIL import Image 
import numpy as np 
import nrrd# Some sample numpy 
import os
import IONData
import SwcLoader
def swc2volume(sampleid,name):

    iondata = IONData.IONData()
    res,path = iondata.getAnnotation()

    # Read the data back from file
    readdata,header=nrrd.read(path)
    readdata[:]=0
    tree = iondata.getNeuronTreeByID(sampleid,name)
    for p in tree.xyz:

        readdata[int(p[0]/10.0),int(p[1]/10.0),int(p[2]/10.0)]=400
    nrrd.write('../resource/nrrd/'+sampleid+name+'.nrrd', readdata)

if __name__=="__main__":
    swc2volume('211984','045.swc')
    pass
